home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / overview / dtscpluslibrary / headers / tracer.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  2.0 KB  |  76 lines

  1. /*
  2.     File:        Tracer.h
  3.  
  4.     Contains:    TTracer is an example of a stack/heap based tracing class, which could be
  5.                   used for tracing memory leaks and keeping track of created objects
  6.                   Tracer.h contains the header file information for the initial class construction.
  7.  
  8.     Written by: Kent Sandvik    
  9.  
  10.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  11.  
  12.                 You may incorporate this Apple sample source code into your program(s) without
  13.                 restriction. This Apple sample source code has been provided "AS IS" and the
  14.                 responsibility for its operation is yours. You are not permitted to redistribute
  15.                 this Apple sample source code as "Apple sample source code" after having made
  16.                 changes. If you're going to re-distribute the source, we require that you make
  17.                 it clear in the source that the code was descended from Apple sample source
  18.                 code, but that you've made changes.
  19.  
  20.     Change History (most recent first):
  21.                 8/18/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  22.                 
  23.  
  24. */
  25. // Declare label for this header file
  26. #ifndef _TRACER_
  27. #define _TRACER_
  28.  
  29. #ifndef _DTSCPLUSLIBRARY_
  30. #include "DTSCPlusLibrary.h"
  31. #endif
  32.  
  33. //    Toolbox Include Files
  34. #ifndef __TYPES__
  35. #include <Types.h>
  36. #endif
  37.  
  38.  
  39. #include <stdlib.h>
  40.  
  41. // make use of the ANSI __FILE__ and __LINE__ macros
  42. #define TRACEPOINT __FILE__,__LINE__
  43.  
  44.  
  45. // _________________________________________________________________________________________________________ //
  46. //    Class Interface
  47. class TTracer
  48. {
  49. public:
  50.     //    CONSTRUCTORS & DESTRUCTORS
  51.     TTracer(const char* className,
  52.             const char* file = 0,
  53.             int line = 0);
  54.     virtual~ TTracer();
  55.  
  56. private:
  57.     // FIELDS
  58.     const char* fLabel;
  59.     const char* fFile;
  60.     int fLine;
  61.     static int fReferenceCount;                    // keep track of how many TTracers we construct
  62. };
  63.  
  64.  
  65. #endif
  66.  
  67. // _________________________________________________________________________________________________________ //
  68.  
  69.  
  70. /*    Change History (most recent last):
  71.   No        Init.    Date        Comment
  72.   1            khs        7/10/92        New file
  73. */
  74.  
  75.  
  76.